<%--
    Document   : feedback
    Created on : Jun 11, 2013, 2:35:04 PM
    Author     : Hoang
--%>

<%@ page contentType="text/html; charset=UTF-8" %>

<jsp:include page="header-sidebar.jsp">
    <jsp:param name="title" value="Feedback"/>
</jsp:include>

<div id="content">
    <div id="shadow">

        <a href="getFeedbackPDF.action" target="_blank">
            <div id="pdf-download">
                <img src="img/Oficina-PDF-icon.png"/>
                <h3>Download PDF</h3>
                <p>Danh sách feedback</p>
            </div></a>

        <h2 class="homeTitle">Feedback</h2>
        <div id="sorting-field">
            <a href="#" onclick="sort_1('username')">Theo người gửi</a> |
            <a href="#" onclick="sort_1('sendDate')">Theo ngày</a> |
            <a href="#" onclick="sort_1('title')">Theo chủ đề</a> |<br/>
            <div id="notify">
                <font color="green"><h3>${requestScope.notify}</h3></font>
            </div>
        </div>

        <div id="feed-content"></div>

        <b id="content-after"></b> </div>
</div>

<script type="text/javascript" src="../js/jsUtils.js"></script>
<script type="text/javascript">

    //Load lai cai search va hien active
    activeCurrentNav("feedbackNav");

    //Cho cai thong bao mat sau 2 giay
    setTimeout(function(){
        document.getElementById("notify").hidden = true;
    }, 2*1000);

    var xml = loadXMLDoc('WEB-INF/dataXML/feedback-user.xml');
    var xsl = loadXMLDoc("WEB-INF/xsl/feed-user-toHtml.xsl");
    window.onload = sort('sendDate','descending');
    var acsend = true;
   
    function sort_1(sortParam)
    {
        if (acsend) {
            sort(sortParam, 'ascending');
        } else {
            sort(sortParam, 'descending');
        }
        acsend = !acsend;
    }

    function confirmDelete(form){
        if (confirm("Bạn thật sự muốn xóa feedback này? ")) {
            return true;
        }
        return false;
    }
    
    function sort(sortParam, order)
    {
        if (document.implementation && document.implementation.createDocument)
        {
            var xsltProcessor=new XSLTProcessor();
            xsltProcessor.importStylesheet(xsl);

            xsltProcessor.setParameter(null,"sort", sortParam);
            xsltProcessor.setParameter(null,"order", order);

            result = xsltProcessor.transformToFragment(xml,document);
            document.getElementById("feed-content").innerHTML = "";
            document.getElementById("feed-content").appendChild(result);
        }
    }
    
</script>


<jsp:include page="footer.jsp"/>